//
//  functions.h
//  Prism
//
//  Created by Bas du Pre on 24-05-11.
//  Copyright 2011 UU. All rights reserved.
//

#pragma once

#include "global.h"

template <class DstType, class SrcType>
bool isType(SrcType* src)
{
    return dynamic_cast<DstType*>(src) != 0;
}

Prism::PInt pRound (Prism::PFloat x);
Prism::PFloat modulus(Prism::PFloat a, Prism::PFloat b);

#if PRISM_OS_WINDOWS == 0
bool posix_isDebuggerPresent(void);
#endif

Prism::String objectToString(Prism::PObject *object);
Prism::String objectToString(Prism::PObject object);
Prism::String objectToString(Prism::String *object);
Prism::String objectToString(Prism::String object);

template <class T>
Prism::String objectToString(T *object) {
    Prism::PObject * po = dynamic_cast<Prism::PObject*>(object);
    if (po != 0) {
        return objectToString((Prism::PObject*) object);
    }
    return Prism::String("Unknown");
}

